#include "ShaderDemo.h"
#include "MainScene.h"
 
CShaderDemo::CShaderDemo( void )
{
}
CShaderDemo::~CShaderDemo(void)
{
}

HRESULT CShaderDemo::OnInitialize( void )
{
	Singleton<CGame>::Instance()->AddDeviceStateDeposit(Singleton<CGraphicsResourceManager>::Instance());
	Singleton<CGame>::Instance()->AddDeviceStateDeposit(Singleton<CPrimiteRender>::Instance());
	Singleton<CGame>::Instance()->AddDeviceStateDeposit(Singleton<CScreenSquare>::Instance());
	Singleton<CGame>::Instance()->AddUpdateDeposit(Singleton<CSceneManager>::Instance());
	Singleton<CGame>::Instance()->AddRenderDeposit(Singleton<CSceneManager>::Instance());
	Singleton<CGame>::Instance()->AddMsgProcessorDeposit(Singleton<CSceneManager>::Instance());
	Singleton<CGame>::Instance()->AddTerminateDeposit(Singleton<CSceneManager>::Instance());
	Singleton<CSceneManager>::Instance()->AddScene(Singleton<CMainScene>::Instance()); 
	Singleton<CGame>::Instance()->AddRenderDeposit(this);
	return S_OK;
}

void CShaderDemo::OnTerminate( void )
{

}
void CShaderDemo::OnD3D9FrameRender( float fElapsedTime )
{
	if(Singleton<CInput>::Instance()->GetKeyboard()->IsKeyUp(DIK_ESCAPE))
	{
	 	if(!Singleton<CSceneManager>::Instance()->ExitTopScene())
			PostQuitMessage(0);
	}
}
